using UnityEngine;

public class DeathBringerAttackState : EnemyState
{
    private new DeathBringer Enemy => (DeathBringer)base.Enemy;

    public DeathBringerAttackState(Enemy enemy, string animName) : base(enemy, animName) { }

    public override void Enter()
    {
        base.Enter();
        Enemy.chanceToTeleport += 5;
    }

    public override void Update()
    {
        base.Update();
        Enemy.SetVelocityToZero();
        if (TriggerCalled)
        {
            if (Enemy.CanTeleport())
                StateMachine.ChangeTo(Enemy.Teleport);
            else
                StateMachine.ChangeTo(Enemy.Battle);
        }
    }

    public override void Exit()
    {
        base.Exit();
        Enemy.lastTimeAttacked = Time.time;
    }
}
